#! /usr/bin/ruby
def check_usage
unless ARGV.length == 2
	puts "Usage: ruby my-diff.rb oldfile newfile"
	exit
end
end

def trans_to_downcase (filename)

	downcased = File.open(filename).collect {|line| line.chomp.downcase}
	downcased.reject {|line| boring?(line) }	
end

def boring? (line)
	contains?(line,'temp') or contains?(line,'recycler')
end

def contains?(line,word)
	line.split('/').include?(word)
end

def compare_array(old_inventory, new_inventory)
old_array= trans_to_downcase (old_inventory)
new_array= trans_to_downcase (new_inventory)

puts "new added files are as below:"

puts ""

puts new_array - old_array

puts "============================="

puts "removed files are as below:"

puts ""

puts old_array - new_array
end

puts "$0 is #{$0}."
puts "__FILE__ is #{__FILE__}." 
if $0 == __FILE__
	check_usage
	compare_array(ARGV[0],ARGV[1])
end
